package UI.editors;

import java.awt.BorderLayout;

import javax.swing.JPanel;

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.fife.ui.rtextarea.RTextScrollPane;

import controller.Editor.ITextEditorController;

/**
 * @date Apr. 16, 2012
 * @author Francisco J. Martínez
 */
public class EditorTextMode extends JPanel {
	
	private static final long serialVersionUID = 201204161855L;
	
	private RSyntaxTextArea theText;
	private RTextScrollPane theScroll;
	private ITextEditorController mController;

	public EditorTextMode() {
		this.setLayout(new BorderLayout());
		
		this.theText = new RSyntaxTextArea();

		this.theText.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_XML);
		this.theText.setCodeFoldingEnabled(true);
		this.theText.setAntiAliasingEnabled(true);

		this.theScroll = new RTextScrollPane(this.theText);
		this.theScroll.setFoldIndicatorEnabled(true);
		this.theScroll.setViewportView(theText);
		this.add(theScroll);
	}
	

	public RSyntaxTextArea getTextArea() {
		return theText;
	}
	
	public void setText(String text){
		theText.setText(text);
	}
	
	public void setController(ITextEditorController controller){
		mController = controller;
	}
	
	public ITextEditorController getController(){
		return mController;
	}
	
}
